<template>
  <div class="lang">
    <!-- <i class="el-icon-basketball" /> -->
    <!-- <svg-icon icon-class="el-icon-basketball" /> -->
    <el-dropdown @command="handleCommand">
      <span class="el-dropdown-link">
        <i class="el-icon-basketball" />
      </span>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="zh">中文</el-dropdown-item>
        <el-dropdown-item command="en">英文</el-dropdown-item>
        <el-button @click.native.prevent="playBasketball">向鸡哥发起篮球邀请?</el-button>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
export default {
  data() {
    return {

    }
  },
  methods: {
    handleCommand(command) {
      this.$i18n.locale = command
      this.$message.success('修改语言成功')
    },
    playBasketball() {
      this.$confirm('鸡哥向你发起篮球邀请!', '您收到一条邀请信息!', {
        confirmButtonText: '接收!',
        cancelButtonText: '拒绝!',
        type: 'warning'
      }).then(() => {
        this.$message.success('接收成功!')
      }).catch(() => {
        this.$message.error('拒绝失败!')
        this.playBasketball()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.lang {
  display: inline-block;
  color: #ffffff;
  margin-right: 20px;
  .el-dropdown {
    .el-dropdown-link {
      cursor: pointer;
      color: #ffffff;
      font-size: 22px;
    }
  }
}
.el-icon-arrow-down {
  font-size: 12px;
}
.el-button {
  border: 0 !important;
}
</style>
